/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sunrise.boundary;

import com.sunrise.entity.Location;


import javax.ejb.Stateless;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Andrea
 */

@Stateless
public class LocationManager {
    
    @PersistenceContext
    private EntityManager entityManager;
    
    public List<Location> findByPlaceIdentifier(String placeIdentifier) {
        
        List<Location> result = new ArrayList<Location>();
        
        try {
            result = entityManager.createNamedQuery(Location.findByPlaceIdentifier, Location.class)
                        .setParameter("placeIdentifier", placeIdentifier)
                        .getResultList();
        
        } catch (Exception ex) {

        }
        
        return result; 
    }
    
}
